#include "CColorButton.h"
#include <QResizeEvent>

CColorButton::CColorButton(QWidget *parent)
    : QPushButton(parent)
{
    setColor(Qt::black);
}

void CColorButton::setColor(QColor color)
{
    this->setStyleSheet(QString("background:%1;color:transparent;").arg(color.name()));
}

void CColorButton::resizeEvent(QResizeEvent *event)
{
    int nLength = qMin(event->size().width(),event->size().height());
    QPushButton::resize(nLength,nLength);
}
